package com.xtm.exercise.base.A18callback;

import org.junit.Test;

//定义主函数-使用匿名内部类 实现callback
public class Main {

    //定义主函数-使用匿名内部类 实现callback
    @Test
    public void main() {

        TestBookCallBack testBookCallBack = new TestBookCallBack();
        testBookCallBack.test(new CallBack() {
            @Override
            public void execute() {
                System.out.println("-------------------Anonymous Inner Class-------------------");
            }
        });
    }

    // 使用callback的实现类 实现callback
    @Test
    public void test01(){

        TestBookCallBack testBookCallBack = new TestBookCallBack();
        BookCallBack bookCallBack = new BookCallBack();
        testBookCallBack.test(bookCallBack);
        System.out.println("---------main---------在主函数中 获取callback实现类里定义的变量值----------" + bookCallBack.getBookName()+"----"+ bookCallBack.getAuthor());
    }
}
